package dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public abstract class GenericDAO<E> {

	protected Map<Integer, E> entities = new HashMap<Integer, E>();
	protected static int sequenceId = 0;

	public abstract E store(E entity);
	public abstract List<E> getAll();
	public abstract E update(E entity);
	
	public E find(Integer id) {
		if (id == null) {
			throw new RuntimeException("ID CANNOT BE NULL OMG");
		}
		return entities.get(id);
	}
	
	public void delete(Integer id) {
		if (id != null) {
			entities.remove(id);
		}
	}
}
